package com.qf.shop.goods.utils;

import com.qf.shop.common.vo.GoodsPngVO;
import com.qf.shop.goods.entity.GoodsPngEntity;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

public class VoUtils {

    public static List<GoodsPngVO> goodsPngEntityToGoodsPngVO(List<GoodsPngEntity> goodsPngEntityList){
        List<GoodsPngVO> voList = new ArrayList<>();
        for (GoodsPngEntity goodsPngEntity : goodsPngEntityList) {
            GoodsPngVO vo = new GoodsPngVO();
            BeanUtils.copyProperties(goodsPngEntity,vo);
            voList.add(vo);
        }
        return voList;
    }

    public static List<GoodsPngEntity> GoodsPngVOToGoodsPngEntity(List<GoodsPngVO> goodsPngVoList){
        List<GoodsPngEntity> entityList = new ArrayList<>();
        for (GoodsPngVO goodsPngVo : goodsPngVoList) {
            GoodsPngEntity entity = new GoodsPngEntity();
            BeanUtils.copyProperties(goodsPngVo,entity);
            entityList.add(entity);
        }
        return entityList;
    }
}
